package net.chrisrichardson.ec2deployer.applications;

import groovy.util.GroovyTestCase;

import java.io.StringWriter;


public class StdoutCapturingProcessMonitorTest extends GroovyTestCase {

    public void test() {
        def writer = new StringWriter();
        StdoutCapturingProcessMonitor s = new StdoutCapturingProcessMonitor(writer)
        def inputString = """hello
This is some input
"""
        def input = new ByteArrayInputStream(inputString.getBytes());
        s.readProcessIn input
        assert writer.toString().startsWith("hello")
        assert writer.toString().contains("This is some input")
    }
}
